package function;

public class Arrangement {
     public static void xzpx(int[]a) {
        //int[] a = new int[]{13, 38, 65, 97, 76, 49, 27};//在定义数组
        for (int i = 0; i < a.length - 1; i++)//做i趟排序
        {
            int k = i;
            for (int j = k + 1; j < a.length; j++) {
                if (a[j] < a[k]) {
                    k = j;//记下目前找到最小值所在的位置
                }
                if (i != k) {
                    int t = a[i];
                    a[i] = a[k];
                    a[k] = t;
                }

            }

        }
    }

    public static void main(String[] args) {
        int a[]={13, 38, 65, 97, 76, 49, 27};
        xzpx(a);
        System.out.print("选择排序后的数组");
        for (int i=0;i<a.length;i++)
        {
            System.out.print(a[i]+" ");
        }
    }

}
